package com.gene.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class PageResult<T> implements Serializable {
	private int pageStart;
	private int pageEnd;
	private int pageSize;//每页多少数
	private int pageNumber;//第几页
	private int totalPage;//共多少页
	private long totalRows;//总数据量
	private List<T> list;
	private String code;
	private String msg;
	public PageResult() {
		super();
	}
	public PageResult(int pageSize, int pageNumber, int totalRows,
					  List<T> list) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
		this.totalRows = totalRows;
		this.pageStart = (pageNumber-1)*pageSize;
		this.pageEnd = pageNumber*pageSize;
		if (totalRows%pageSize==0){ //整除
			this.totalPage = totalRows/pageSize; 	
		}else{
			this.totalPage = totalRows/pageSize+1;
		}
		this.list = list;
		if (this.list==null) {
			this.list=new ArrayList<T>();
		}
		
	}
	public int getPageStart() {
		return pageStart;
	}
	public void setPageStart(int pageStart) {
		this.pageStart = pageStart;
	}
	public int getPageEnd() {
		return pageEnd;
	}
	public void setPageEnd(int pageEnd) {
		this.pageEnd = pageEnd;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getPageNumber() {
		return pageNumber;
	}
	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}
	public int getTotalPage() {
		return totalPage;
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public long getTotalRows() {
		return totalRows;
	}
	public void setTotalRows(long totalRows) {
		this.totalRows = totalRows;
	}
	public List<T> getList() {
		return list;
	}
	public void setList(List<T> list) {
		this.list = list;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
}
